package cn.cdeden.resource.dubbo;

import cn.cdeden.common.oss.enumd.OssModuleType;
import cn.cdeden.resource.api.RemoteRecentlyFileDeleteService;
import cn.cdeden.resource.service.ISysOssDownloadRecordService;
import cn.cdeden.resource.service.ISysOssRecentlyViewedService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Service;

import java.util.Collection;

/**
 * @ProjectName : KnowCore
 * @Package : cn.cdeden.resource.dubbo
 * @ClassName : RemoteRecentlyFileDeleteServiceImpl
 * @Author : Yu.
 * @Description : // TODO
 * @Date : 2025/1/9 14:02
 * @Version : 1.0
 */

@Slf4j
@RequiredArgsConstructor
@Service
@DubboService
public class RemoteRecentlyFileDeleteServiceImpl implements RemoteRecentlyFileDeleteService {


    private final ISysOssRecentlyViewedService viewedService;
    private final ISysOssDownloadRecordService downloadService;


    @Override
    public void deleteViewedByModuleId(Collection<String> moduleId, OssModuleType type) {
        deleteViewedByModuleId(moduleId, type, null);
    }

    @Override
    public void deleteViewedByModuleId(Collection<String> moduleId, OssModuleType type, Collection<String> userId) {
        Boolean b = viewedService.deleteViewedByModuleId(moduleId, type, false, userId);
    }

    @Override
    public void deleteDownloadByModuleId(Collection<String> moduleId, OssModuleType type) {
        deleteDownloadByModuleId(moduleId, type, null);
    }

    @Override
    public void deleteDownloadByModuleId(Collection<String> moduleId, OssModuleType type, Collection<String> userId) {
        Boolean b = downloadService.deleteDownloadByModuleId(moduleId, type, false, userId);
    }

    @Override
    public void deleteByModuleId(Collection<String> moduleId, OssModuleType type) {
        deleteByModuleId(moduleId, type, null);
    }

    @Override
    public void deleteByModuleId(Collection<String> moduleId, OssModuleType type, Collection<String> userId) {
        deleteViewedByModuleId(moduleId, type, userId);
        deleteDownloadByModuleId(moduleId, type, userId);
    }
}
